<template>
    <div class="app">
        <h2>Vue Route</h2>
        <div class="nav">
            <RouterLink replace to="/home" active-class="actively" class="nav-link">首页</RouterLink>
            <RouterLink :to="{name:'xinwen'}" active-class="actively" class="nav-link">新闻</RouterLink>
            <RouterLink :to="{path:'/about'}" active-class="actively" class="nav-link">关于</RouterLink> 
        </div>
        <div class="content">
            这是一个展示页面
            <RouterView></RouterView>
        </div>
    </div>
</template>

<script lang="ts" setup name="App">
import { RouterView } from 'vue-router'


</script>

<style scoped>
.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh; /* 占据视口的高度 */
    text-align: center;
}

.nav {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.nav-link {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: color 0.3s ease;
}

.actively {
    color: #007BFF; /* 蓝色高亮 */
}

.content {
    border: 1px solid black;
    margin-top: 20px;
    font-size: 18px;
}
</style>